-
Notifications
You must be signed in to change notification settings - Fork 2k
Help Center: add image upload for chats #96105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~59 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~628 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~1513 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
import { useCallback, useRef, useState } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { Icon, upload } from '@wordpress/icons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use image
instead of upload to reflect what's in the designs. But we may think to ask Lucas to go with a generic upload if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works fine! Great job!
I noticed that for old chats, the attachment button does not appear, only for new chats, not sure if it is intentional.
Will check code now.
@@ -99,3 +99,15 @@ export const calculateUnread = ( conversations: ZendeskConversation[] ) => { | |||
|
|||
return { unreadConversations, unreadMessages }; | |||
}; | |||
|
|||
export const getClientId = ( conversations: ZendeskConversation[] ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could reduce the nested loop to make it faster/simpler. I have tested and works great.
export const getClientId = ( conversations: ZendeskConversation[] ): string =>
conversations
.flatMap( ( conversation ) => conversation.messages )
.find( ( message ) => message.source.type === 'web' && message.source.id )?.source.id || '';
@@ -87,6 +89,7 @@ export const OdieSendMessageButton = () => { | |||
keyUpHandle={ onKeyUp } | |||
/> | |||
{ shouldBeDisabled && <Spinner className="odie-send-message-input-spinner" /> } | |||
<AttachmentButton /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT if we add the shouldUseHelpCenterExperience
check here instead of inside the component?, this would avoid unnecessary mounts
{shouldUseHelpCenterExperience && <AttachmentButton /> }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed this change
@@ -19,6 +19,21 @@ $blueberry-color: #3858e9; | |||
height: 40px; | |||
max-height: 210px; | |||
} | |||
|
|||
.components-form-file-upload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heavyweight I have added this to add the border and correct size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heavyweight I loved the simplicity of this PR, you did an astonishing job!
Left minimal suggestions, it's up to you to address them.
The PR adds support for image file uploads in zendesk conversations.
Fixes https://github.com/Automattic/dotcom-forge/issues/9644
Proposed Changes
Let's add the possibility of sending an image in the chat!
Testing Instructions
/home?flags=help-center-experience
and open the Help Center.